package com.xjscrm.console.web.group;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.xjscrm.console.param.group.BatchDelWwGroupClassifyDto;
import com.xjscrm.console.param.group.WwGroupClassifyDto;
import com.xjscrm.console.param.group.WwGroupClassifyQuery;
import com.xjscrm.console.service.customer.group.WwGroupClassifyBatchService;
import com.xjscrm.console.service.customer.group.WwGroupClassifyService;
import com.xjscrm.console.vo.WwGroupClassifyVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "群组预设管理", tags = "群组预设管理")
@RestController
@RequestMapping(value = "/wwGroupClassify")
public class WwGroupClassifyController {

    @Autowired
    private WwGroupClassifyService wwGroupClassifyService;

    @Autowired
    private WwGroupClassifyBatchService wwGroupClassifyBatchService;


    @ApiOperation(value = "新增群组预设", notes = "新增群组预设", response = Boolean.class)
    @PostMapping(value = "/addWwGroupClassify")
    @ApiOperationSupport(order = 1)
    public Object addWwGroupClassify(@RequestBody WwGroupClassifyDto wwGroupClassifyDto) throws Exception {
        wwGroupClassifyService.addWwGroupClassify(wwGroupClassifyDto);
        return true;
    }

    @ApiOperation(value = "修改群组预设", notes = "修改群组预设", response = Boolean.class)
    @PostMapping(value = "/updateWwGroupClassify")
    @ApiOperationSupport(order = 2)
    public Object updateWwGroupClassify(@RequestBody WwGroupClassifyDto wwGroupClassifyDto) throws Exception {
        wwGroupClassifyService.updateWwGroupClassify(wwGroupClassifyDto);
        return true;
    }

    @ApiOperation(value = "获取群组预设列表", notes = "获取群组预设列表", response = WwGroupClassifyVo.class)
    @PostMapping(value = "/getWwGroupClassifyList")
    @ApiOperationSupport(order = 3)
    public Object getWwGroupClassifyList(@RequestBody WwGroupClassifyQuery wwGroupClassifyQuery) throws Exception {
        return wwGroupClassifyService.getWwGroupClassifyList(wwGroupClassifyQuery);
    }

    @ApiOperation(value = "获取群组预设详情", notes = "获取群组预设详情", response = WwGroupClassifyVo.class)
    @PostMapping(value = "/getWwGroupClassifyDetail")
    @ApiOperationSupport(order = 4)
    public Object getWwGroupClassifyDetail(@RequestBody WwGroupClassifyDto wwGroupClassifyDto) throws Exception {
        return wwGroupClassifyService.getWwGroupClassifyDetail(wwGroupClassifyDto);
    }

    @ApiOperation(value = "批量删除群组预设", notes = "批量删除群组预设", response = Boolean.class)
    @PostMapping(value = "/batchDelWwGroupClassify")
    @ApiOperationSupport(order = 5)
    public Object batchDelWwGroupClassify(@RequestBody BatchDelWwGroupClassifyDto batchDelWwGroupClassifyDto) throws Exception {
        wwGroupClassifyBatchService.batchDelWwGroupClassify(batchDelWwGroupClassifyDto);
        return true;
    }
}
